/**
 * 〈一句话功能简述〉<br>
 * 〈〉
 *
 * @author 13754
 * @create 2023/11/29
 * @since 1.0.0
 */
package com.mengniu.commerce.collect.third.request;

import com.alibaba.fastjson.JSONObject;
import com.mengniu.commerce.collect.third.WeiMengApi;
import com.mengniu.commerce.collect.third.response.act.ActDataResponse;
import com.mengniu.commerce.collect.util.RestTemplateUtil;
import com.mengniu.commerce.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 微盟会员数据请求
 * @author 13754
 * @Date 2023/11/29 11:55
 * @Version 1.0.0
 */
@Service
public class IWeiMengActRequest {

    private static String baseUrl ="https://dopen.weimob.com";

    @Autowired
    RestTemplateUtil restTemplateUtil;


    /**
     * 行为日志
     * @param
     * @return
     */
    public ActDataResponse getAct(String date, int limit, String cursorId, String token){
        JSONObject js = new JSONObject();
        js.put("searchDate",date);
        js.put("limit",limit);
        if (!StringUtils.isEmpty(cursorId)){
            js.put("cursorId",cursorId);
        }
        String url =baseUrl+ WeiMengApi.WM_ACT_DATA;
        String result = restTemplateUtil.doPost(js, url,token);
        System.out.println(result);
        return  JSONObject.parseObject(result,ActDataResponse.class);
    }

}
